/*
 * @Author: 卡卡 1071780426@qq.com
 * @Date: 2023-04-11 10:30:06
 * @LastEditors: 卡卡 1071780426@qq.com
 * @LastEditTime: 2023-04-11 11:49:36
 * @FilePath: \mould\src\store\modules\getLqTheadData.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// getName.js

import {

    getUserCompanyTreeList, //编辑详情
} from "@/api/request.js";
export default {
    namespaced: true, // 命名空间
    state: {
        dataList: [] // 名称列表
    },
    mutations: {
        changeNameList(state, payload) {
            state.dataList = payload;
        }
    },
    actions: {
        getTree(context, payload) {
            // var data = {
            //     companyId: JSON.parse(sessionStorage.getItem("monitorBack-userInfo")).companyId,
            //     userId: JSON.parse(sessionStorage.getItem("monitorBack-userInfo")).userId
            // }
            getUserCompanyTreeList(payload).then(res => {
                if (res.errcode == 0) {
                    // this.state.dataList = res.data.userCompanyTreeList
                    context.commit("changeNameList", res.data.userCompanyTreeList);
                } else {
                    this.$message.error(res.msg);
                }
            });
        }
    }
};